All Functions Used So Far, Week 2

head

{utils}

Show first 5 rows of a data frame

ungroup

{dplyr}

Resolve grouping created with “group_by”

scale_x_continuous

{GGPLOT2}

Customise continuous x axis

labs

{GGPLOT2}

Customise labels in GGPLOT2

group_by

{dplyr}

Group tibble/data.frame by a factor variable. All further tidyverse operations are performed group-wise

theme_classic

{GGPLOT2}

A minimalistic theme with no gridlines

attach

{base}

Attach Set of R Objects to Search Path

sum

{base}

Get sum of numeric values or a vector

median

{stats}

Get median of a vector

View

{base}

View a data frame

rbind

{base}

Combine R objects by rows

arrange

{dplyr}

Sort values of data frame according to a variable/combination of varaibles

rm

{base}

Remove objects

ggtitle

{GGPLOT2}

Generates a title for a ggplot graph

library

{base}

Load an R package

setwd

{base}

Set Working Directory

summary

{base}

Obtain summary statistics or detailed regression output

range

{base}

Return range of values

ls

{base}

Return a vector of character strings giving the names of the objects in the specified environment

ordered

{dplyr}

Create an ordered factor

c

{base}

Combine values/vectors into a vector

cut

{base}

Convert Numeric to Factor

hist

{graphics}

Plot a simple histogram

nrow

{base}

Get number of rows of a data frame

slice

{dplyr}

Subset rows using their positions

freq

{questionr}

Generate frequency tables

filter

{dplyr}

Filter out rows of a data frame according to logical vector

plot

{graphics}

Generic function from base R to produce a plot

ifelse

{base}

Return a or b depending on the value of test

desc

{dplyr}

Arrange in descending order

max

{base}

Get maximum of a vector

dim

{base}

Get dimensions of a data frame

names

{base}

Retrieve names of a list/vector

geom_bar

{GGPLOT2}

Generates a bar chart

factor

{base}

Create a factor

sd

{stats}

Get standard deviation of a vector

summarise

{dplyr}

collapse the dataset to a summary statistic. Usually used with group_by()

mean

{base}

Get mean of a vector

min

{base}

Get minimum of a vector

subset

{base}

Return subsets of vectors, matrices or data frames which meet conditions.

boxplot

{graphics}

Plot a simple box plot

lprop

{questionr}

Display row percentages of a two-way frequency table

seq

{base}

Create a sequence

var

{stats}

Calculate variance

is.na

{base}

Check if a value is NA/elements of vector are NA

read.spss

{foreign}

Read a .sav file (SPSS data)

cbind

{base}

Combine R objects by columns

geom_histogram

{GGPLOT2}

Generates a histogram

recode

{dplyr}

Recode a variable

mutate

{dplyr}

Modify/create a column in a data frame

ggplot

{GGPLOT2}

Create a ggplot graph

select

{dplyr}

Select columns from a tibble/data frame

pie

{graphics}

Creates a basic pie chart

ls.str

{utils}

Similarly to ls, with a print() method that calls str() on each object

str

{utils}

Get the structure of an R object

levels

{base}

Get levels of a factor

install.packages

{base}

Install R package

ncol

{base}

Get number of columns of a data frame

aes

{GGPLOT2}

Construct aesthetic mapping of a ggplot graph

read_excel

{readxl}

Read an Excel file

table

{base}

Obtain frequency table of a variable/cross-tabulation of two variables

class

{base}

Retrieve class of an R object

The end!